<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
    <ui:define name="head">
        <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form">
            <p:growl id="msgs" showDetail="false"/>
            <h:panelGrid id= "pgCondition" style="width: 100%">
                <h:panelGrid columns="8">
                    <h:outputLabel for="noItemHieRelap" value="编号:" />
                    <h:inputText id="noItemHieRelap"
                                 value="#{cttDTkAction.rowCttD.strNo}"
                                 readonly="#{cttDTkAction.styleModelNo.disabled_Flag}"
                                 style="#{cttDTkAction.styleModelNo.disabled_Style}">
                        <p:ajax event="blur" update="msgs,pgOperBtn"
                                 listener="#{cttDTkAction.blurStrNoToGradeAndOrderidAction}"/>
                    </h:inputText>
                    <h:outputLabel for="name" value="名称:" />
                    <h:inputText id="name" value="#{cttDTkAction.rowCttD.name}"
                                 readonly="#{cttDTkAction.styleModel.disabled_Flag}"
                                 style="#{cttDTkAction.styleModel.disabled_Style}"/>
                    <h:outputLabel for="note" value="备注内容:" />
                    <h:inputText id="note" value="#{cttDTkAction.rowCttD.note}"
                                 readonly="#{cttDTkAction.styleModel.disabled_Flag}"
                                 style="#{cttDTkAction.styleModel.disabled_Style}"/>
                    <h:outputLabel for="unitItemInfo" value="单位:"/>
                    <h:inputText id="unitItemInfo" value="#{cttDTkAction.rowCttD.unit}"
                                 readonly="#{cttDTkAction.styleModel.disabled_Flag}"
                                 style="#{cttDTkAction.styleModel.disabled_Style}"/>
                    <h:outputLabel for="contractUnitPriceItemInfo" value="合同单价:"/>
                    <h:inputText id="contractUnitPriceItemInfo"
                                 value="#{cttDTkAction.rowCttD.contractUnitPrice}"
                                 readonly="#{cttDTkAction.styleModel.disabled_Flag}"
                                 style="#{cttDTkAction.styleModel.disabled_Style};text-align:right;float:left">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        <p:ajax event="blur" update="contractAmountItemInfo"
                                listener="#{cttDTkAction.blurCalculateAmountAction}"/>
                    </h:inputText>
                    <h:outputLabel for="contractQuantityItemInfo" value="合同数量:"/>
                    <h:inputText id="contractQuantityItemInfo"
                                 value="#{cttDTkAction.rowCttD.contractQuantity}"
                                 readonly="#{cttDTkAction.styleModel.disabled_Flag}"
                                 style="#{cttDTkAction.styleModel.disabled_Style};text-align:right;float:left">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        <p:ajax event="blur" update="contractAmountItemInfo"
                                listener="#{cttDTkAction.blurCalculateAmountAction}"/>
                    </h:inputText>
                    <h:outputLabel for="contractAmountItemInfo" value="合同金额:"/>
                    <h:inputText id="contractAmountItemInfo"
                                 value="#{cttDTkAction.rowCttD.contractAmount}"
                                 style="text-align:right;background-color:gainsboro"
                                 readonly="true">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:inputText>
                    <h:outputLabel for="originFlagItemInfo" value="数据来源:" />
                    <h:inputText id="originFlagItemInfo"
                                 value="#{commonAction.originFlagListValueOfAlias(
                                 cttDTkAction.rowCttD.originFlag)}"
                                 style="background-color:gainsboro" readonly="true"/>
                    <h:outputLabel for="createdByItemInfo" value="创建人:" />
                    <h:inputText id="createdByItemInfo"
                                 value="#{cttDTkAction.rowCttD.createdByName}"
                                 style="background-color:gainsboro" readonly="true"/>
                    <h:outputLabel for="createdDateItemInfo" value="创建时间:" />
                    <h:inputText id="createdDateItemInfo"
                                 value="#{cttDTkAction.rowCttD.createdDate}"
                                 style="background-color:gainsboro" readonly="true"/>
                    <h:outputLabel for="lastUpdByItemInfo" value="修改人:" />
                    <h:inputText id="lastUpdByItemInfo"
                                 value="#{cttDTkAction.rowCttD.lastUpdByName}"
                                 style="background-color:gainsboro" readonly="true"/>
                    <h:outputLabel for="lastUpdDateItemInfo" value="修改时间:" />
                    <h:inputText id="lastUpdDateItemInfo"
                                 value="#{cttDTkAction.rowCttD.lastUpdDate}"
                                 style="background-color:gainsboro" readonly="true"/>
                    <h:outputLabel for="modificationNumItemInfo" value="修改次数:" />
                    <h:inputText id="modificationNumItemInfo"
                                 value="#{cttDTkAction.rowCttD.modificationNum}"
                                 style="background-color:gainsboro;text-align:right;" readonly="true">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                    </h:inputText>
                </h:panelGrid>
                <h:panelGrid id="pgOperBtn" columns="3" rendered='#{cttDTkAction.strMngNotFinishFlag}'>
                    <p:commandButton id="submitBtn"
                                     value="#{cttDTkAction.strSubmitType eq 'Add'?'提交（增加）':
                                               cttDTkAction.strSubmitType eq 'Upd'?'提交（更新）':
                                               cttDTkAction.strSubmitType eq 'Del'?'提交（删除）':'提交'}"
                                     action="#{cttDTkAction.submitThisRecordAction}"
                                     update="pgCondition,ptt,msgs,pcm">
                    </p:commandButton>
                    <p:commandButton id="resetBtn" value="重置"
                                     action="#{cttDTkAction.resetAction}"
                                     update="pgCondition,pcm">
                    </p:commandButton>
                    <p:ajaxStatus style="width:16px;height:16px;">
                        <f:facet name="start">
                            <h:graphicImage value="/images/ajaxloading.gif"/>
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value=""/>
                        </f:facet>
                    </p:ajaxStatus>
                </h:panelGrid>
            </h:panelGrid>
            <p:contextMenu id="pcm" for="ptt" rendered='#{cttDTkAction.strMngNotFinishFlag}'>
                <p:menuitem value="更新" icon="ui-icon-arrowrefresh-1-w"
                            actionListener="#{cttDTkAction.selectRecordAction('Upd')}"
                            update="pgCondition,msgs,ptt,pcm">
                </p:menuitem>
                <p:menuitem value="删除" icon="ui-icon-close"
                            actionListener="#{cttDTkAction.selectRecordAction('Del')}"
                            update="pgCondition,msgs,ptt,pcm">
                </p:menuitem>
                <p:menuitem value="复制" icon="ui-icon-copy"
                            actionListener="#{cttDTkAction.selectRecordAction('Copy')}"
                            update="pgCondition,msgs,ptt,pcm">
                </p:menuitem>
                <p:menuitem value="剪切" icon="ui-icon-scissors"
                            actionListener="#{cttDTkAction.selectRecordAction('Cut')}"
                            update="pgCondition,msgs,ptt,pcm">
                </p:menuitem>
                <p:menuitem value="粘贴（同层_上）" icon="ui-icon-clipboard"
                            actionListener="#{cttDTkAction.selectRecordAction('Paste_brother_up')}"
                            update="pgCondition,msgs,ptt,pcm"
                            rendered="#{cttDTkAction.strPasteBtnRendered}">
                </p:menuitem>
                <p:menuitem value="粘贴（同层_下）" icon="ui-icon-clipboard"
                            actionListener="#{cttDTkAction.selectRecordAction('Paste_brother_down')}"
                            update="pgCondition,msgs,ptt,pcm"
                            rendered="#{cttDTkAction.strPasteBtnRendered}">
                </p:menuitem>
                <p:menuitem value="粘贴（子层）" icon="ui-icon-clipboard"
                            actionListener="#{cttDTkAction.selectRecordAction('Paste_children')}"
                            update="pgCondition,msgs,ptt,pcm"
                            rendered="#{cttDTkAction.strPasteBtnRendered}">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="ptt"
                     value="#{cttDTkAction.rowCttDList}"
                     var="record"
                     rowKey="#{record.pkid}"
                     selection="#{cttDTkAction.rowCttDSelected}"
                     selectionMode="single"
                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                     {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                     paginator="true"
                     paginatorPosition="bottom"
                     rows="15"
                     rowsPerPageTemplate="500,200,90,45,30,15"
                     rowIndexVar="row"
                     emptyMessage="数据记录为空..."
                     rowStyleClass="#{record.name eq '合计'? 'rowDoneStyle':
                     record.name eq '总合计'? 'rowDoneStyle':null}"
                     scrollable="true"
                     scrollHeight="400">
                <p:column style="width:30px" headerText="序号">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column style="width:120px" headerText="编号">
                    <h:outputText value="#{record.strNo}" escape="false"/>
                </p:column>
                <p:column style="width:360px" headerText="名称">
                    <h:outputText value="#{record.name}" />
                </p:column>
                <p:column style="width:30px" headerText="单位">
                    <h:outputText value="#{record.unit}" style="text-align:right"/>
                </p:column>
                <p:column style="width:80px" headerText="合同单价">
                    <h:outputText value="#{record.contractUnitPrice}" style="float: right" >
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:80px" headerText="合同数量">
                    <h:outputText value="#{record.contractQuantity}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:100px" headerText="合同金额">
                    <h:outputText value="#{record.contractAmount}" style="float: right">
                        <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                    </h:outputText>
                </p:column>
                <p:column style="width:300px" headerText="备注">
                    <h:outputText value="#{record.note}" />
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>